Results

Setup

functions

Mean function for ggplot2 plots

meanFunction <- function(x){
  return(data.frame(y=round(mean(x),2),label=round(mean(x,na.rm=T),2)))}

themes to use with ggplot2

themes_ggplot <- theme_bw() +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank())+
  font("xlab", size = 12, color = "black", face = "bold") +
  font("ylab", size = 12, color = "black", face = "bold") +
  font("title", size = 14, color = "black", face = "bold")+
  font("legendtitle", size = 12, color = "black", face = "bold")+
  font("legendtext", size = 12, color = "black")+
  font("xy.text", size = 12, color = "black")+
  font("ylab", size = 12, color = "black", face = "bold") +
  font("xlab", size = 12, color = "black", face = "bold") +
  theme(strip.text.x = element_text( size = 12, color = "black", face = "bold"))+
  theme(strip.text.y = element_text( size = 12, color = "black", face = "bold"))+
  theme(legend.position='top')

chosen_colors = c("#9ecae1", "#a63603", "#e6550d", "#fd8d3c", "#fdbe85", "#feedde") 

general parameters

OUT_DIR <- "results/small_datasets/"
sra_table_path <- "raw/small_datasets/unitedCoronaSRATable.csv"
dir.create(OUT_DIR)
## Warning in dir.create(OUT_DIR): 'results/small_datasets' already exists
# dbgap_data_path <- "/private9/Projects/COVID_NASAL_DBGAP_TEMPORARY/temp_krt_dbgap/combined_sample_subject_attribute.csv"

# dbgap_table <- read.csv(file= dbgap_data_path, stringsAsFactors=FALSE)
sra_table <- read.csv(file= sra_table_path, stringsAsFactors=FALSE, sep=",")

sra_table$Group[sra_table$Project == "Nasal Swabs (GSE166530)" & sra_table$Group == "Controls"] <- "temp"
sra_table$Group[sra_table$Project == "Nasal Swabs (GSE166530)" & sra_table$Group == "COVID"] <- "Controls"
sra_table$Group[sra_table$Project == "Nasal Swabs (GSE166530)" & sra_table$Group == "temp"] <- "COVID"
sra_table$Group[sra_table$Project == "Nasal Swabs (GSE166530)" & sra_table$Group == "COVID"] <- "Controls"
sra_table$Group[sra_table$Group == "Controls"] <- "Control"

sra_table$Project <- factor(sra_table$Project,levels = c('Nasal Swabs (GSE166530)','Whole Blood (GSE167000)',
                                                     'Whole Blood (GSE171110)','Leukocytes (GSE157103)'))

kable(head(sra_table)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Run Project Source Group Subject
SRR12544421 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753022
SRR12544422 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753022
SRR12544423 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753023
SRR12544424 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753023
SRR12544425 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753024
SRR12544426 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753024

Analysis tables

SALMON

ADARexp = c("raw/small_datasets/Covid19_GSE157103_SalmonTPM_ADAR.wideSamples.csv",
            "raw/small_datasets/WholeBlood_GSE171110_SalmonTPM_ADAR.wideSamples.csv",
            "raw/small_datasets/Blood_GSE167000_SalmonTPM_ADAR.wideSamples.csv",
            "raw/small_datasets/nasal_swabs_GSE166530_ADAR.wideSamples.csv")

#read all files to one table

df_salmon = ADARexp %>%
  map_dfr(compose(function (f) dcast(f, Sample~GeneSymbol),
                  function (f) melt(f, variable.name = "Sample", id.var = "GeneSymbol", value.name = "TPM"),
                  function (f) fread(f, header=T, check.names = F, stringsAsFactors=FALSE))) %>%
  filter(!grepl(pattern = "_counts", x = Sample)) %>%
  mutate(Sample = gsub("_TPM", replacement = "", x = Sample)) 
## Using 'TPM' as value column. Use 'value.var' to override
## Using 'TPM' as value column. Use 'value.var' to override
## Using 'TPM' as value column. Use 'value.var' to override
## Using 'TPM' as value column. Use 'value.var' to override
kable(head(df_salmon)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Sample ADAR ADARB1 ADARB2 ADARB2-AS1
SRR12544419 368.004 6.04658 0.061325 0
SRR12544420 366.173 8.26516 0.000000 0
SRR12544421 163.731 4.80513 0.000000 0
SRR12544422 175.065 3.94874 0.000000 0
SRR12544423 349.408 3.03863 0.000000 0
SRR12544424 348.612 2.32348 0.000000 0

ISG

ISG_path <- c("raw/small_datasets/Covid19_GSE157103_ArticleCalcLog2_ISG_madz_scores.csv",
        "raw/small_datasets/WholeBlood_GSE171110_ArticleCalcLog2_ISG_madz_scores.csv",
        "raw/small_datasets/Blood_GSE167000_ArticleCalcLog2_ISG_madz_scores.csv",
        "raw/small_datasets/Covid_nasal_swabs_GSE166530_ArticleCalcLog2_ISG_madz_scores.csv")

df_isg = ISG_path %>% 
  map_dfr(fread, header = T, stringsAsFactors = F)  %>%
filter(!grepl(pattern = "_counts", x = Sample)) %>%
  mutate(Sample = gsub("_TPM", replacement = "", x = Sample)) 

kable(head(df_isg)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Sample ISG38_score
SRR12544419 1.4220689
SRR12544420 1.4264640
SRR12544421 0.0092516
SRR12544422 0.0248549
SRR12544423 1.4387706
SRR12544424 1.4381190

STAR

STAR = c("raw/small_datasets/Covid19_GSE157103_STAR_stats.csv",
        "raw/small_datasets/WholeBlood_GSE171110_STAR_stats.csv",
        "raw/small_datasets/Blood_GSE167000_STAR_stats.csv",
        "raw/small_datasets/Covid_nasal_swabs_GSE166530_STAR_stats.csv")

STAR_stats = STAR %>% 
  map_dfr(fread, header = T, stringsAsFactors = F) 

kable(head(STAR_stats)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Sample Number of input reads Average input read length Uniquely mapped reads number Uniquely mapped reads % Average mapped length Number of splices: Total Number of splices: Annotated (sjdb) Number of splices: GT/AG Number of splices: GC/AG Number of splices: AT/AC Number of splices: Non-canonical Mismatch rate per base % Deletion rate per base Deletion average length Insertion rate per base Insertion average length Number of reads mapped to multiple loci % of reads mapped to multiple loci Number of reads mapped to too many loci % of reads mapped to too many loci Number of reads unmapped: too many mismatches % of reads unmapped: too many mismatches Number of reads unmapped: too short % of reads unmapped: too short Number of reads unmapped: other % of reads unmapped: other Number of chimeric reads % of chimeric reads
SRR12544455 15006318 102 12417854 82.75 101.68 3612887 3566408 3578305 26150 2983 5449 0.22 0.00 1.49 0 1.33 0 0 1183602 7.89 0 0 1397839 9.32 7023 0.05 0 0
SRR12544419 15588448 102 12936578 82.99 101.69 4236774 4188200 4198293 29657 3759 5065 0.21 0.00 1.46 0 1.30 0 0 1189641 7.63 0 0 1454754 9.33 7475 0.05 0 0
SRR12544454 13608114 102 11737417 86.25 101.69 3658305 3606749 3624765 25202 3018 5320 0.22 0.00 1.47 0 1.31 0 0 1257326 9.24 0 0 607018 4.46 6353 0.05 0 0
SRR12544420 15431677 102 12800775 82.95 101.69 4193008 4144994 4154429 29742 3804 5033 0.23 0.00 1.46 0 1.29 0 0 1181697 7.66 0 0 1441952 9.34 7253 0.05 0 0
SRR12544421 9258530 102 7836692 84.64 101.70 2474920 2443621 2452500 17277 1997 3146 0.22 0.00 1.39 0 1.31 0 0 888586 9.60 0 0 528857 5.71 4395 0.05 0 0
SRR12544463 12823761 102 10446156 81.46 101.68 2716139 2679307 2691212 18952 2153 3822 0.22 0.01 1.41 0 1.35 0 0 952437 7.43 0 0 1419432 11.07 5736 0.04 0 0

Alu-index

aluIndex_path = c("raw/small_datasets/Covid19_GSE157103_EditingIndex.csv",
             "raw/small_datasets/WholeBlood_GSE171110_EditingIndex.csv",
             "raw/small_datasets/Blood_GSE167000_EditingIndex.csv",
             "raw/small_datasets/Covid_nasal_swabs_GSE166530_EditingIndex.csv")

#read all files to one table
aluIndex = aluIndex_path %>% 
  map_dfr(fread, header = T, stringsAsFactors = F) %>% 
  dplyr::select("Sample","A2GEditingIndex","A2TEditingIndex","C2AEditingIndex",
                "C2TEditingIndex", "C2GEditingIndex","A2CEditingIndex")

#change the column names
names(aluIndex) <- gsub("EditingIndex","EditingIndex_Alu",
                        names(aluIndex))

kable(head(aluIndex)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Sample A2GEditingIndex_Alu A2TEditingIndex_Alu C2AEditingIndex_Alu C2TEditingIndex_Alu C2GEditingIndex_Alu A2CEditingIndex_Alu
SRR12544643 1.2274776 0.0599239 0.0617665 0.1894718 0.0461365 0.0534655
SRR12544640 1.0706102 0.0519371 0.0487548 0.1440984 0.0377717 0.0427339
SRR12544479 1.0688495 0.0437524 0.0458131 0.1324161 0.0296800 0.0346312
SRR12544517 0.8622589 0.0493260 0.0511186 0.1189223 0.0334008 0.0434031
SRR12544489 1.1620090 0.0501233 0.0551385 0.1709712 0.0399206 0.0451556
SRR12544522 1.0952535 0.0538721 0.0614048 0.1614525 0.0457137 0.0462310

combine the plots

#combine all tables to one table
df_combined <- left_join(sra_table, df_salmon ,by=c("Run"="Sample")) %>%
  left_join(df_isg ,by=c("Run"="Sample")) %>%
  left_join(aluIndex,by=c("Run"="Sample")) %>%
  left_join(STAR_stats,by=c("Run"="Sample"))

out_path <- paste0(OUT_DIR,"/combinedResults_all.csv")
write.csv(df_combined, out_path, row.names = F, quote = F)

kable(head(df_combined)) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Run Project Source Group Subject ADAR ADARB1 ADARB2 ADARB2-AS1 ISG38_score A2GEditingIndex_Alu A2TEditingIndex_Alu C2AEditingIndex_Alu C2TEditingIndex_Alu C2GEditingIndex_Alu A2CEditingIndex_Alu Number of input reads Average input read length Uniquely mapped reads number Uniquely mapped reads % Average mapped length Number of splices: Total Number of splices: Annotated (sjdb) Number of splices: GT/AG Number of splices: GC/AG Number of splices: AT/AC Number of splices: Non-canonical Mismatch rate per base % Deletion rate per base Deletion average length Insertion rate per base Insertion average length Number of reads mapped to multiple loci % of reads mapped to multiple loci Number of reads mapped to too many loci % of reads mapped to too many loci Number of reads unmapped: too many mismatches % of reads unmapped: too many mismatches Number of reads unmapped: too short % of reads unmapped: too short Number of reads unmapped: other % of reads unmapped: other Number of chimeric reads % of chimeric reads
SRR12544421 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753022 163.731 4.80513 0.000000 0 0.0092516 1.052801 0.0452625 0.0427253 0.1282110 0.0326654 0.0381811 9258530 102 7836692 84.64 101.70 2474920 2443621 2452500 17277 1997 3146 0.22 0.00 1.39 0 1.31 0 0 888586 9.60 0 0 528857 5.71 4395 0.05 0 0
SRR12544422 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753022 175.065 3.94874 0.000000 0 0.0248549 1.043986 0.0469718 0.0479044 0.1329852 0.0347423 0.0379615 9151662 102 7743902 84.62 101.69 2450458 2419100 2428365 16879 2062 3152 0.24 0.00 1.39 0 1.32 0 0 880380 9.62 0 0 523164 5.72 4216 0.05 0 0
SRR12544423 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753023 349.408 3.03863 0.000000 0 1.4387706 1.298069 0.0442355 0.0479175 0.1484962 0.0396385 0.0395406 13238599 102 11325557 85.55 101.70 3180001 3127132 3150636 22548 2697 4120 0.21 0.00 1.49 0 1.33 0 0 1186839 8.96 0 0 720607 5.44 5596 0.04 0 0
SRR12544424 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753023 348.612 2.32348 0.000000 0 1.4381190 1.286904 0.0496128 0.0516164 0.1481855 0.0408331 0.0443446 13102365 102 11198594 85.47 101.69 3146771 3094910 3118163 21950 2655 4003 0.23 0.00 1.49 0 1.34 0 0 1181938 9.02 0 0 716379 5.47 5454 0.04 0 0
SRR12544425 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753024 134.683 7.86667 0.000000 0 -0.0118132 1.008229 0.0561895 0.0522114 0.1764840 0.0432753 0.0471505 13924194 102 10880240 78.14 101.66 3391078 3349157 3360426 23663 2853 4136 0.23 0.00 1.51 0 1.31 0 0 1083481 7.78 0 0 1954801 14.04 5672 0.04 0 0
SRR12544426 Leukocytes (GSE157103) leukocyte COVID-19 GSM4753024 138.416 9.47355 0.022476 0 -0.0054734 1.000815 0.0621749 0.0578964 0.1775207 0.0461696 0.0484435 13774083 102 10760249 78.12 101.65 3352312 3311124 3321848 23545 2843 4076 0.25 0.01 1.51 0 1.31 0 0 1074460 7.80 0 0 1933765 14.04 5609 0.04 0 0

General statistics

df_combined_Stats <- df_combined %>% 
  group_by(Project,Group) %>% #nrow()
  summarize(ADAR = paste(round(mean(ADAR, na.rm=T),2), "(",round(min(ADAR,na.rm=T),2),", ", 
                         round(max(ADAR,na.rm=T),2),", ",round(median(ADAR,na.rm=T),2),", +-",
                         round(sd(ADAR,na.rm=T),2),")"),
            ADARB1 = paste(round(mean(ADARB1,na.rm=T),2), "(",round(min(ADARB1,na.rm=T),2),", ", 
                           round(max(ADARB1,na.rm=T),2),", ",round(median(ADARB1,na.rm=T),2),", +-",
                           round(sd(ADARB1,na.rm=T),2),")"),
            ADARB2 = paste(round(mean(ADARB2,na.rm=T),2), "(",round(min(ADARB2,na.rm=T),2),", ", 
                           round(max(ADARB2,na.rm=T),2),", ",round(median(ADARB2,na.rm=T),2),", +-",
                           round(sd(ADARB2,na.rm=T),2),")"),
            ADARB2.AS1 = paste(round(mean(`ADARB2-AS1`,na.rm=T),2), "(",round(min(`ADARB2-AS1`,na.rm=T),2),", ", 
                               round(max(`ADARB2-AS1`,na.rm=T),2),", ",round(median(`ADARB2-AS1`,na.rm=T),2),", +-",
                               round(sd(`ADARB2-AS1`,na.rm=T),2),")"),
            ISG38_score = paste(round(mean(ISG38_score,na.rm=T),2), "(",round(min(ISG38_score,na.rm=T),2),", ", 
                                round(max(ISG38_score,na.rm=T),2),", ",round(median(ISG38_score,na.rm=T),2), ", +-",
                                round(sd(ISG38_score,na.rm=T),2),")"),
           A2GEditingIndex_Alu = paste(round(mean(A2GEditingIndex_Alu,na.rm=T),2), "(",
                                       round(min(A2GEditingIndex_Alu,na.rm=T),2),", ", 
                                    round(max(A2GEditingIndex_Alu, na.rm=T),2),", ",
                                    round(median(A2GEditingIndex_Alu, na.rm=T),2), ", +-", 
                                    round(sd(A2GEditingIndex_Alu, na.rm=T),2),")")
            ) 
## `summarise()` has grouped output by 'Project'. You can override using the
## `.groups` argument.
write.csv(df_combined_Stats, paste0(OUT_DIR,"/combinedResults_mean_min_max_median_sd.csv"), 
          row.names = F, quote = F)

kable(df_combined_Stats) %>%
  kable_styling(bootstrap_options = c("striped", "hover", 'condensed')) 
Project Group ADAR ADARB1 ADARB2 ADARB2.AS1 ISG38_score A2GEditingIndex_Alu
Nasal Swabs (GSE166530) Control 9.14 ( 7.21 , 14.39 , 7.75 , +- 3 ) 1.09 ( 0.46 , 2.22 , 0.66 , +- 0.77 ) 1.23 ( 0.25 , 2.81 , 1.05 , +- 0.98 ) 0.6 ( 0 , 2.6 , 0 , +- 1.13 ) 0.13 ( -0.05 , 0.67 , -0.03 , +- 0.31 ) 0.63 ( 0.29 , 0.89 , 0.64 , +- 0.27 )
Nasal Swabs (GSE166530) COVID-19 14.85 ( 0.27 , 117.56 , 6.96 , +- 23.2 ) 0.86 ( 0 , 6.77 , 0.39 , +- 1.37 ) 0.31 ( 0 , 0.9 , 0.26 , +- 0.23 ) 0.01 ( 0 , 0.2 , 0 , +- 0.03 ) 0.08 ( -1.15 , 1.85 , -0.01 , +- 0.74 ) 2.74 ( 0.53 , 5.3 , 2.52 , +- 1.06 )
Whole Blood (GSE167000) Control 94.2 ( 41.24 , 156.32 , 84.43 , +- 33.77 ) 5.91 ( 1.43 , 14.31 , 4.46 , +- 3.79 ) 0.83 ( 0 , 7.6 , 0 , +- 1.97 ) 0 ( 0 , 0 , 0 , +- 0 ) -0.6 ( -0.88 , -0.26 , -0.62 , +- 0.13 ) 1.33 ( 1.12 , 1.46 , 1.35 , +- 0.09 )
Whole Blood (GSE167000) COVID-19 139.54 ( 54.87 , 286.61 , 130.65 , +- 63.14 ) 5.51 ( 2.14 , 9.46 , 4.7 , +- 2.12 ) 0.79 ( 0 , 6.76 , 0 , +- 1.88 ) 0 ( 0 , 0 , 0 , +- 0 ) -0.39 ( -0.78 , 0.01 , -0.42 , +- 0.23 ) 1.43 ( 1.19 , 1.69 , 1.45 , +- 0.13 )
Whole Blood (GSE171110) Control 174.56 ( 123.25 , 285.98 , 167.92 , +- 35.36 ) 15.36 ( 6.16 , 47.17 , 12.83 , +- 8.99 ) 0.47 ( 0 , 3.76 , 0 , +- 0.8 ) 0 ( 0 , 0 , 0 , +- 0 ) -0.27 ( -0.49 , 0.51 , -0.38 , +- 0.28 ) 1.44 ( 1.34 , 1.67 , 1.43 , +- 0.09 )
Whole Blood (GSE171110) COVID-19 256.1 ( 126.24 , 532.3 , 235.07 , +- 75.27 ) 12.8 ( 1.13 , 127.56 , 10.2 , +- 11.75 ) 2.65 ( 0 , 18.83 , 0.05 , +- 4.38 ) 0.01 ( 0 , 1.46 , 0 , +- 0.12 ) 0.17 ( -0.73 , 1.62 , 0.06 , +- 0.6 ) 1.72 ( 1.37 , 2.07 , 1.72 , +- 0.18 )
Leukocytes (GSE157103) Control 96.59 ( 24.16 , 176.28 , 90.93 , +- 45.08 ) 3.59 ( 0.49 , 8.54 , 3.33 , +- 1.99 ) 0.91 ( 0 , 3.9 , 0.53 , +- 1.09 ) 0 ( 0 , 0.2 , 0 , +- 0.03 ) -0.35 ( -1.56 , 0.63 , -0.45 , +- 0.46 ) 1 ( 0.81 , 1.18 , 1 , +- 0.07 )
Leukocytes (GSE157103) COVID-19 165.08 ( 17.7 , 382.3 , 163.74 , +- 79.22 ) 4 ( 0.15 , 14.41 , 3.66 , +- 2.47 ) 1.23 ( 0 , 12.77 , 0.07 , +- 2.11 ) 0.01 ( 0 , 0.89 , 0 , +- 0.07 ) 0.1 ( -1.51 , 1.44 , -0.01 , +- 0.6 ) 1.1 ( 0.86 , 1.39 , 1.1 , +- 0.1 )

Plots

Alu-Index

A-G clean signal

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

 edit_type_names <- c("A2GEditingIndex_Alu" = "A-G\n(T-C)", "A2TEditingIndex_Alu" = "A-T\n(T-A)", 
                      "C2AEditingIndex_Alu" = "C-A\n(G-T)", "C2TEditingIndex_Alu" = "C-T\n(G-A)", 
                      "C2GEditingIndex_Alu" = "C-G\n(G-C)",  "A2CEditingIndex_Alu" = "A-C\n(T-G)")
plot_GSE157103.Mismatches <-
  df_combined %>%
  filter(Project =="Leukocytes (GSE157103)") %>%
  dplyr::select("Run", "Project", 
                "A2GEditingIndex_Alu","A2TEditingIndex_Alu",
         "C2AEditingIndex_Alu","C2TEditingIndex_Alu",
         "C2GEditingIndex_Alu","A2CEditingIndex_Alu") %>%
  gather(edit_type, value, -Run, -Project) %>%
  ggplot(aes(y=value, x=edit_type ,fill=edit_type))+
  geom_boxplot(aes(fill=edit_type)) +  
  themes_ggplot+
  facet_grid(~Project)+
  # theme(axis.text.x = element_text(angle = 90))+
  ylab("ALU Editing Index")+ xlab ("Nucleotide mismatch")+
  scale_fill_discrete(name = "Mistmatch:")+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none") +
  scale_fill_manual(values=c("yellow", "red", "blue", "green", "orange", "black"))+
  scale_x_discrete(labels= edit_type_names)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
plot_GSE157103.Mismatches

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

plot_GSE166530.Mismatches <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  dplyr::select("Run", "Project", 
                "A2GEditingIndex_Alu","A2TEditingIndex_Alu",
         "C2AEditingIndex_Alu","C2TEditingIndex_Alu",
         "C2GEditingIndex_Alu","A2CEditingIndex_Alu") %>%
  gather(edit_type, value, -Run, -Project) %>%
  ggplot(aes(y=value, x=edit_type ,fill=edit_type))+
  geom_boxplot(aes(fill=edit_type)) +  
  themes_ggplot+
  facet_grid(~Project)+
  # theme(axis.text.x = element_text(angle = 90))+
  ylab("ALU Editing Index")+ xlab ("Nucleotide mismatch")+
  scale_fill_discrete(name = "Mistmatch:")+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none") +
  scale_fill_manual(values=c("yellow", "red", "blue", "green", "orange", "black"))+
  scale_x_discrete(labels= edit_type_names)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
plot_GSE166530.Mismatches

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

plot_GSE167000.Mismatches <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  dplyr::select("Run", "Project", 
                "A2GEditingIndex_Alu","A2TEditingIndex_Alu",
         "C2AEditingIndex_Alu","C2TEditingIndex_Alu",
         "C2GEditingIndex_Alu","A2CEditingIndex_Alu") %>%
  gather(edit_type, value, -Run, -Project) %>%
  ggplot(aes(y=value, x=edit_type ,fill=edit_type))+
  geom_boxplot(aes(fill=edit_type)) +  
  themes_ggplot+
  facet_grid(~Project)+
  # theme(axis.text.x = element_text(angle = 90))+
  ylab("ALU Editing Index")+ xlab ("Nucleotide mismatch")+
  scale_fill_discrete(name = "Mistmatch:")+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none") +
  scale_fill_manual(values=c("yellow", "red", "blue", "green", "orange", "black"))+
  scale_x_discrete(labels= edit_type_names)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
plot_GSE167000.Mismatches

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

plot_GSE171110.Mismatches <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  dplyr::select("Run", "Project", 
                "A2GEditingIndex_Alu","A2TEditingIndex_Alu",
         "C2AEditingIndex_Alu","C2TEditingIndex_Alu",
         "C2GEditingIndex_Alu","A2CEditingIndex_Alu") %>%
  gather(edit_type, value, -Run, -Project) %>%
  ggplot(aes(y=value, x=edit_type ,fill=edit_type))+
  geom_boxplot(aes(fill=edit_type)) +  
  themes_ggplot+
  facet_grid(~Project)+
  # theme(axis.text.x = element_text(angle = 90))+
  ylab("ALU Editing Index")+ xlab ("Nucleotide mismatch")+
  scale_fill_discrete(name = "Mistmatch:")+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none") +
  scale_fill_manual(values=c("yellow", "red", "blue", "green", "orange", "black"))+
  scale_x_discrete(labels= edit_type_names)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
plot_GSE171110.Mismatches

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

 plot_grid(plot_GSE166530.Mismatches, 
          plot_GSE167000.Mismatches,
          plot_GSE171110.Mismatches,
          plot_GSE157103.Mismatches,
          labels = c('', '','',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"AluIndex_all_cleanSignal.pdf")
ggsave(out_path, width = 18, height = 6)         

Alu-Index

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Leukocytes (GSE157103)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Leukocytes (GSE157103)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE157103 <-
  df_combined %>%
  filter(Project =="Leukocytes (GSE157103)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE157103

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530 <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110

plot_grid(plot_GSE166530, plot_GSE167000, plot_GSE171110, plot_GSE157103,
          labels = c('', '','',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"AluEditing_all_combined.pdf")
ggsave(out_path, width = 14, height = 6)

SALMON

Leukocytes (GSE157103)

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Leukocytes (GSE157103)") %>% .$ADAR)

c <- df_combined %>% 
  filter(Project =="Leukocytes (GSE157103)") %>%
  compare_means(ADAR ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE157103.ADAR <-
  df_combined %>%
  filter(Project =="Leukocytes (GSE157103)") %>%
  ggplot(
               aes(y=ADAR, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE157103.ADAR

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Leukocytes (GSE157103)") %>% .$ADARB1)

c <- df_combined %>% 
  filter(Project =="Leukocytes (GSE157103)") %>%
  compare_means(ADARB1 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE157103.ADARB1 <-
  df_combined %>%
  filter(Project =="Leukocytes (GSE157103)") %>%
  ggplot(
               aes(y=ADARB1, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE157103.ADARB1

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Leukocytes (GSE157103)") %>% .$ADARB2)

c <- df_combined %>% 
  filter(Project =="Leukocytes (GSE157103)") %>%
  compare_means(ADARB2 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE157103.ADARB2 <-
  df_combined %>%
  filter(Project =="Leukocytes (GSE157103)") %>%
  ggplot(
               aes(y=ADARB2, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE157103.ADARB2

plot_grid(plot_GSE157103.ADAR+facet_grid(~"ADAR"), 
          plot_GSE157103.ADARB1+facet_grid(~"ADAR2"), 
          plot_GSE157103.ADARB2+facet_grid(~"ADAR3"),
          labels = c('', '',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"SALMON_Leukocytes_GSE157103.pdf")
ggsave(out_path, width = 14, height = 6)
#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530 <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110

plot_grid(plot_GSE166530, plot_GSE167000, plot_GSE171110, plot_GSE157103,
          labels = c('', '','',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"AluEditing_all_combined.pdf")
ggsave(out_path, width = 14, height = 6)

Nasal Swab (GSE157103)

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$ADAR)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(ADAR ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530.ADAR <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=ADAR, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530.ADAR

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$ADARB1)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(ADARB1 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530.ADARB1 <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=ADARB1, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530.ADARB1

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$ADARB2)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(ADARB2 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530.ADARB2 <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=ADARB2, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530.ADARB2

plot_grid(plot_GSE166530.ADAR+facet_grid(~"ADAR"), 
          plot_GSE166530.ADARB1+facet_grid(~"ADAR2"), 
          plot_GSE166530.ADARB2+facet_grid(~"ADAR3"),
          labels = c('', '',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"SALMON_Nasal Swabs_GSE166530.pdf")
ggsave(out_path, width = 14, height = 6)

Whole Blood (GSE167000)

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$ADAR, na.rm=T)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(ADAR ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000.ADAR <-
  df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=ADAR, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000.ADAR
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$ADARB1, na.rm=T)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(ADARB1 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000.ADARB1 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=ADARB1, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000.ADARB1
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$ADARB2,na.rm=T)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(ADARB2 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000.ADARB2 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=ADARB2, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000.ADARB2
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).

plot_grid(plot_GSE167000.ADAR+facet_grid(~"ADAR"), 
          plot_GSE167000.ADARB1+facet_grid(~"ADAR2"), 
          plot_GSE167000.ADARB2+facet_grid(~"ADAR3"),
          labels = c('', '',''), label_size = 12, ncol=4)
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).

out_path <- paste0(OUT_DIR,'/',"SALMON_WholeBlood_GSE167000.pdf")
ggsave(out_path, width = 14, height = 6)
#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530 <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$A2GEditingIndex_Alu)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(A2GEditingIndex_Alu ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=A2GEditingIndex_Alu, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("ALU Editing Index")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110

plot_grid(plot_GSE166530, plot_GSE167000, plot_GSE171110, plot_GSE157103,
          labels = c('', '','',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"AluEditing_all_combined.pdf")
ggsave(out_path, width = 14, height = 6)

Nasal Swabs (GSE166530)

Whole Blood (GSE167000)

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$ADAR, na.rm=T)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(ADAR ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110.ADAR <-
  df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=ADAR, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110.ADAR

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$ADARB1, na.rm=T)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(ADARB1 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110.ADARB1 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=ADARB1, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110.ADARB1

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$ADARB2,na.rm=T)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(ADARB2 ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110.ADARB2 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=ADARB2, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  # facet_grid( ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Normalized Expression (TPM)")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110.ADARB2

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

plot_grid(plot_GSE171110.ADAR+facet_grid(~"ADAR"), 
          plot_GSE171110.ADARB1+facet_grid(~"ADAR2"), 
          plot_GSE171110.ADARB2+facet_grid(~"ADAR3"),
          labels = c('', '',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"SALMON_WholeBlood_GSE171110.pdf")
ggsave(out_path, width = 14, height = 6)

All datasets

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)

 plot_grid(plot_GSE166530.ADAR+facet_grid(~"Nasal Swabs (GSE166530)"), 
          plot_GSE167000.ADAR+facet_grid(~"Whole Blood (GSE167000)"),
          plot_GSE171110.ADAR+facet_grid(~"Whole Blood (GSE171110)"),
          plot_GSE157103.ADAR+facet_grid(~"Leukocytes (GSE157103)"),
          labels = c('', '','',''), label_size = 12, ncol=4)
## Warning: Removed 51 rows containing non-finite values (stat_boxplot).
## Warning: Removed 51 rows containing missing values (geom_point).

out_path <- paste0(OUT_DIR,'/',"SALMON_All_adar1.pdf")
ggsave(out_path, width = 16, height = 6)         

ISG

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Leukocytes (GSE157103)") %>% .$ISG38_score)

c <- df_combined %>% 
  filter(Project =="Leukocytes (GSE157103)") %>%
  compare_means(ISG38_score ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE157103 <-
  df_combined %>%
  filter(Project =="Leukocytes (GSE157103)") %>%
  ggplot(
               aes(y=ISG38_score, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Interferon signalling genes")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE157103

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>% .$ISG38_score)

c <- df_combined %>% 
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  compare_means(ISG38_score ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE166530 <-
  df_combined %>%
  filter(Project =="Nasal Swabs (GSE166530)") %>%
  ggplot(
               aes(y=ISG38_score, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Interferon signalling genes")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE166530

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE167000)") %>% .$ISG38_score)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE167000)") %>%
  compare_means(ISG38_score ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE167000 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE167000)") %>%
  ggplot(
               aes(y=ISG38_score, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Interferon signalling genes")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE167000

#Leukocytes (GSE157103)  Nasal Swabs (GSE166530) Whole Blood (GSE167000) Whole Blood (GSE171110)
y_position = max(df_combined%>% 
  filter(Project =="Whole Blood (GSE171110)") %>% .$ISG38_score)

c <- df_combined %>% 
  filter(Project =="Whole Blood (GSE171110)") %>%
  compare_means(ISG38_score ~Group, data = .)
c %<>% mutate(y_pos = c(y_position *1), 
              labels = ifelse(p < 0.05, sprintf("%2.1e",p),p))
# c <- c[c(1,3,2),] #reorder manually sorry
c$p.adj.format <- c$p.adj
c$p.adj.format[c$p.adj < 2e-16] <- "< 2e-16"
c$p.adj.format[as.numeric(c$p.adj) > 0.1] <- "N.S"

c$p.adj.format.stars <- c$p.adj
c$p.adj.format.stars[c$p.adj >= 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.1] <- "ns"
c$p.adj.format.stars[c$p.adj < 0.05] <- paste0("* (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.01] <- paste0("** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 0.001] <- paste0("*** (p=", c$p.adj,")")
c$p.adj.format.stars[c$p.adj < 2e-16] <- paste0("**** (p=", c$p.adj,")")

df_c <- as.data.frame(c)

plot_GSE171110 <-
  df_combined %>%
  filter(Project =="Whole Blood (GSE171110)") %>%
  ggplot(
               aes(y=ISG38_score, x=Group))+
  geom_boxplot(aes(fill=Group)) +  geom_jitter( size=2, alpha = 0.2)+
  facet_grid(  ~ Project ,  drop = TRUE, scales = "free", space = "free",)+
  themes_ggplot+ ylab("Interferon signalling genes")+ xlab ("Group")+ scale_fill_discrete(name = "Group:")+
  expand_limits(y = 0) + scale_fill_manual(values=c("blue","red"))+
  theme(axis.title.x = element_blank())+ theme(legend.position = "none")+
  geom_signif(data = df_c, 
              aes(xmin=group1, xmax=group2, annotations=p.adj.format.stars, y_position=y_pos),manual = TRUE)
## Scale for 'fill' is already present. Adding another scale for 'fill', which
## will replace the existing scale.
## Warning: Ignoring unknown aesthetics: xmin, xmax, annotations, y_position
plot_GSE171110

plot_grid(plot_GSE166530, plot_GSE167000, plot_GSE171110, plot_GSE157103,
          labels = c('', '','',''), label_size = 12, ncol=4)

out_path <- paste0(OUT_DIR,'/',"ISG_all_combined.pdf")
ggsave(out_path, width = 14, height = 6)

correlation

corr_alu_ADAR <- df_combined %>% 
  ggplot(aes(y=A2GEditingIndex_Alu, x=ADAR))+ facet_wrap(~Project)+
  geom_point(aes(color=Group),size=3, alpha = 0.4) + themes_ggplot+ geom_smooth(method='lm', se=F, colour ="black")+
  stat_cor(method = "pearson", label.x.npc = "left", label.y.npc = "top") + scale_color_manual(values=c("blue","red"), name = "Group:") +
  ylab("ALU Editing Index")+ xlab ("ADAR1 Normalized Expression (TPM)")

corr_alu_ADAR
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing non-finite values (stat_cor).
## Warning: Removed 51 rows containing missing values (geom_point).

out_path <- paste0(OUT_DIR,'/',"corr_Alu_ADAR.pdf")
ggsave(out_path, corr_alu_ADAR, width = 10, height = 6)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing non-finite values (stat_cor).
## Warning: Removed 51 rows containing missing values (geom_point).
corr_ISG_ADAR <- df_combined %>% 
ggplot(aes(y=ISG38_score, x=ADAR))+
  geom_point(aes(color=Group),size=3, alpha = 0.4) + themes_ggplot+ geom_smooth(method='lm', se=F, colour ="black")+
  facet_wrap(~Project)+
  stat_cor(method = "pearson", label.x.npc = "left", label.y.npc = "top") + scale_color_manual(values=c("blue","red"), name = "Group:") +
  ylab("Interferon-Stimulated Genes Score")+ xlab ("ADAR1 Normalized Expression (TPM)")

corr_ISG_ADAR
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing non-finite values (stat_cor).
## Warning: Removed 51 rows containing missing values (geom_point).

out_path <- paste0(OUT_DIR,'/',"corr_ISG_ADAR.pdf")
ggsave(out_path, corr_ISG_ADAR, width = 10, height = 6)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing non-finite values (stat_cor).
## Warning: Removed 51 rows containing missing values (geom_point).
corr_ISG_Alu <- df_combined %>% 
ggplot(aes(x=A2GEditingIndex_Alu, y=ISG38_score))+
  geom_point(aes(color=Group),size=3, alpha = 0.4) + 
  themes_ggplot+ geom_smooth(method='lm', se=F, colour ="black")+ facet_wrap(~Project)+
  stat_cor(method = "pearson", label.x.npc = "left", label.y.npc = "top") + scale_color_manual(values=c("blue","red"), name = "Group:") +
  xlab("Interferon-Stimulated Genes Score")+ ylab (" ALU Editing Index")

corr_ISG_Alu
## `geom_smooth()` using formula 'y ~ x'

out_path <- paste0(OUT_DIR,'/',"corr_corr_ISG_Alu.pdf")
ggsave(out_path, corr_ISG_ADAR, width = 10, height = 6)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 51 rows containing non-finite values (stat_smooth).
## Warning: Removed 51 rows containing non-finite values (stat_cor).
## Warning: Removed 51 rows containing missing values (geom_point).